var isValid = function (s) {
    let map = {
        "[": "]",
        "{": "}",
        "(": ")"
    };
    let arr = [];
    let len = s.length;
    for (let i = 0; i < len; i++) {
        if (s[i] == '[' || s[i] == '{' || s[i] == '(') {
            arr.push(s[i]);
        } else {
            if (s[i] == map[arr[arr.length - 1]]) {
                arr.pop();
            } else {
                return false;
            }
        }
    }
    return arr.length > 0 ? false : true;
};